﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using palmApp.Session;
using palmApp.RF;

namespace palmApp
{
    public partial class loginScreen : Form
    {
        RFConnManager rfManager = RFConnManager.Instance;

        public loginScreen()
        {
            InitializeComponent();
            this.ShowDialog();
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            menuItem2.Text = "Ingresar";
            textBox1.Text = rfManager.RFID;

            mobileSession mbSession = mobileSession.Instance;

            mbSession.tag_id_responsible = textBox1.Text;
            mbSession.Read();

            textBox2.Text = mbSession.name + " " + mbSession.lastname1;
            textBox3.Text = mbSession.charge;
        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            if (menuItem2.Text == "Ingresar")
            {
                if (radioButton1.Checked)
                {
                    personalSessionScreen ps = new personalSessionScreen();
                    radioButton1.Checked = false;
                    ps = null;
                }
                if (radioButton2.Checked)
                {
                    mainScreen ms = new mainScreen();
                    radioButton2.Checked = false;
                    ms = null;
                }
            }
            else
            {
                Application.Exit();
            }

            menuItem2.Text = "Salir";
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
        }

        private void label7_ParentChanged(object sender, EventArgs e)
        {

        }

        private void label5_ParentChanged(object sender, EventArgs e)
        {

        }

        private void label4_ParentChanged(object sender, EventArgs e)
        {

        }

        private void label3_ParentChanged(object sender, EventArgs e)
        {

        }

        private void loginScreen_Load(object sender, EventArgs e)
        {

        }

        private void loginScreen_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == System.Windows.Forms.Keys.Up))
            {
                // Up
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Down))
            {
                // Down
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Left))
            {
                // Left
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Right))
            {
                // Right
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
            {
                // Enter
            }

        }

        private void panel1_GotFocus(object sender, EventArgs e)
        {

        }
    }
}